<?php

if (version_compare(phpversion(), '5.2.0', '<') === true) {
    die('ERROR: Your PHP version is ' . phpversion() . '. require PHP 5.2.0 or newer.');
}

ini_set('display_errors', 1);
error_reporting(E_ALL|E_STRICT|E_NOTICE);

date_default_timezone_set('Asia/Yekaterinburg');

define('DS', DIRECTORY_SEPARATOR);

define('APPLICATION_ROOT_DIR', dirname(__FILE__));

defined('APPLICATION_PATH') || 
	define('APPLICATION_PATH', APPLICATION_ROOT_DIR . DS . 'application');

defined('APPLICATION_ENV') || 
	define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

define('APPLICATION_TEMP', APPLICATION_ROOT_DIR . DS . "temp");	

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_ROOT_DIR . DS . 'library'),
    get_include_path(),
)));

require_once 'Zend/Application.php';
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . DS . 'configs' . DS . 'application.ini'
);
try {
	$application->bootstrap()->run();
} catch(Exception $e) {
	header('HTTP/1.1 500 Internal Server Error');
	require APPLICATION_ROOT_DIR . DS . 'data' . DS . 'errors' . DS . '500.php';
}
